package com.atguigu.spzx.common.exception;

import com.atguigu.spzx.common.result.ResultCodeEnum;
import lombok.Data;

/**
 * <p>
 * GuiguException
 * </p>
 *
 * @author flyduck
 * @since 2023/10/21
 */
@Data
public class GuiguException extends RuntimeException{

    private Integer code;
    private String message;
    private ResultCodeEnum resultCodeEnum;

    public GuiguException(ResultCodeEnum resultCodeEnum){
        this.resultCodeEnum = resultCodeEnum;
        this.code = resultCodeEnum.getCode();
        this.message = resultCodeEnum.getMessage();
    }

    public GuiguException(ResultCodeEnum resultCodeEnum,Exception e){
        super(resultCodeEnum.getMessage(),e);
        this.resultCodeEnum = resultCodeEnum;
        this.code = resultCodeEnum.getCode();
        this.message = resultCodeEnum.getMessage();
    }


}
